using TrueSync;
using UnityEngine;


public static class TrueSyncExtensions
{
    public static TSVector ToTSVector(this Vector3 _vector)
    {
        return new TSVector(_vector.x, _vector.y, _vector.z);
    }

    public static TSVector2 ToTSVector2(this Vector3 _vector)
    {
        return new TSVector2(_vector.x, _vector.y);
    }

    public static TSVector ToTSVector(this Vector2 _vector)
    {
        return new TSVector(_vector.x, _vector.y, 0);
    }

    public static TSVector2 ToTSVector2(this Vector2 _vector)
    {
        return new TSVector2(_vector.x, _vector.y);
    }

    public static Vector3 Abs(this Vector3 _vector)
    {
        return new Vector3(Mathf.Abs(_vector.x), Mathf.Abs(_vector.y), Mathf.Abs(_vector.z));
    }

    public static TSQuaternion ToTSQuaternion(this Quaternion _rot)
    {
        return new TSQuaternion(_rot.x, _rot.y, _rot.z, _rot.w);
    }

    public static Quaternion ToQuaternion(this TSQuaternion _rot)
    {
        return new Quaternion((float)_rot.x, (float)_rot.y, (float)_rot.z, (float)_rot.w);
    }

    public static TSMatrix ToTSMatrix(this Quaternion _rot)
    {
        return TSMatrix.CreateFromQuaternion(_rot.ToTSQuaternion());
    }

    public static Vector3 ToVector(this TSVector _jVector)
    {
        return new Vector3((float)_jVector.x, (float)_jVector.y, (float)_jVector.z);
    }

    public static Vector3 ToVector(this TSVector2 _jVector)
    {
        return new Vector3((float)_jVector.x, (float)_jVector.y, 0);
    }

    public static void Set(this TSVector _jVector, TSVector _otherVector)
    {
        _jVector.Set(_otherVector.x, _otherVector.y, _otherVector.z);
    }

    public static Quaternion ToQuaternion(this TSMatrix _jMatrix)
    {
        return TSQuaternion.CreateFromMatrix(_jMatrix).ToQuaternion();
    }
}